import http from "@/api";
import { ResPage, Cms } from "@/api/interface/index";
import qs from "qs";

//帮助中心列表
export const getHelpCenterList = (params: Cms.HelpCenterParams) => {
  return http.post<ResPage<Cms.HelpCenter>>(`helpCenter/list`, qs.stringify(params));
};
//编辑帮助中心
export const saveHelpCenter = (params: Cms.HelpCenter) => {
  return http.post(`helpCenter/save`, qs.stringify(params));
};
//删除帮助中心
export const delHelpCenter = (params: { ids: number }) => {
  return http.post(`helpCenter/del`, qs.stringify(params));
};
//帮助中心详情
export const getHelpCenterInfo = (params: { id: number }) => {
  return http.post<Cms.HelpCenter>(`helpCenter/info`, qs.stringify(params));
};

//文章分类列表
export const getArticleCateList = (params: Cms.ArticleCateParams) => {
  return http.post<ResPage<Cms.ArticleCate>>(`articleCate/list`, qs.stringify(params));
};
//编辑文章分类
export const saveArticleCate = (params: Cms.ArticleCate) => {
  return http.post(`articleCate/save`, qs.stringify(params));
};
//删除文章分类
export const delArticleCate = (params: { codes: string }) => {
  return http.post(`articleCate/del`, qs.stringify(params));
};
//切换文章分类状态
export const changeArticleCateStatus = (params: { id: number; status: number }) => {
  return http.post(`articleCate/status`, qs.stringify(params));
};

//文章列表
export const getArticleList = (params: Cms.ArticleParams) => {
  return http.post<ResPage<Cms.ArticleList>>(`article/list`, qs.stringify(params));
};
//编辑文章
export const saveArticle = (params: Cms.ArticleInfo) => {
  return http.post(`article/save`, qs.stringify(params));
};
//删除文章
export const delArticle = (params: { ids: number }) => {
  return http.post(`article/del`, qs.stringify(params));
};
//文章详情
export const getArticleInfo = (params: { id: number }) => {
  return http.post<Cms.ArticleInfo>(`article/info`, qs.stringify(params));
};
//切换文章状态
export const changeArticleStatus = (params: { id: number; status: number }) => {
  return http.post(`article/status`, qs.stringify(params));
};
